package cn.ac.iscas.domain.job;

import cn.ac.iscas.domain.component.IComponentParameter;

import java.io.Serializable;
import java.util.List;

/**
 * Created by ISCAS on 2017/9/27.
 * 前台给后台回传的组件bean结构定义
 */

/*
public class Component implements Serializable {
	private String id;//组件实例的唯一id，一个任务中可以有多个相同name的组件，但是id不能重复\
	private String entryClassName;
	private String algorithm;// 对应flink中类型
	private String alias;//显示名称
	private ComponentType type;//e or t or l ---ComponentType
	private String modelType;//组件唯一类别名称，组件的入口类名

	private int xPos;
	private int yPos;

	//todo: 应该改成嵌套对象，更方便查找后续节点
	private List<String> front;  //前置节点id号
	private List<String> next; //后续节点id

	private Map<String, Object> parameter;//组件所需参数


	@Override
	public String toString() {
		return "Component{" +
				"id:'" + id + '\'' +
				", algorithm:'" + algorithm + '\'' +
				", alias:'" + alias + '\'' +
				", type:'" + type + '\'' +
				", xPos:" + xPos +
				", yPos:" + yPos +
				", front:" + front +
				", next:" + next +
				'}';
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEntryClassName() {
		return entryClassName;
	}

	public void setEntryClassName(String entryClassName) {
		this.entryClassName = entryClassName;
	}

	public String getAlgorithm() {
		return algorithm;
	}

	public void setAlgorithm(String algorithm) {
		this.algorithm = algorithm;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public ComponentType getType() {
		return type;
	}

	public void setType(ComponentType type) {
		this.type = type;
	}

	public String getModelType() {
		return modelType;
	}

	public void setModelType(String modelType) {
		this.modelType = modelType;
	}

	public int getxPos() {
		return xPos;
	}

	public void setxPos(int xPos) {
		this.xPos = xPos;
	}

	public int getyPos() {
		return yPos;
	}

	public void setyPos(int yPos) {
		this.yPos = yPos;
	}

	public List<String> getFront() {
		return front;
	}

	public void setFront(List<String> front) {
		this.front = front;
	}

	public List<String> getNext() {
		return next;
	}

	public void setNext(List<String> next) {
		this.next = next;
	}

	public Map<String, Object> getParameter() {
		return parameter;
	}

	public void setParameter(Map<String, Object> parameter) {
		this.parameter = parameter;
	}
}
*/

public class Component<T extends IComponentParameter> implements Serializable {
	private String id;//组件实例的唯一id，一个任务中可以有多个相同name的组件，但是id不能重复\
	private String entryClassName;
	private String algorithm;// 对应flink中类型
	private String alias;//显示名称
	private ComponentType type;//e or t or l ---ComponentType
	private String modelType;//组件唯一类别名称，组件的入口类名

	private int xPos;
	private int yPos;

	//todo: 应该改成嵌套对象，更方便查找后续节点
	private List<String> front;  //前置节点id号
	private List<String> next; //后续节点id

	private T parameter;//组件所需参数


	@Override
	public String toString() {
		return "Component{" +
				"id:'" + id + '\'' +
				", algorithm:'" + algorithm + '\'' +
				", alias:'" + alias + '\'' +
				", type:'" + type + '\'' +
				", xPos:" + xPos +
				", yPos:" + yPos +
				", front:" + front +
				", next:" + next +
				'}';
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEntryClassName() {
		return entryClassName;
	}

	public void setEntryClassName(String entryClassName) {
		this.entryClassName = entryClassName;
	}

	public String getAlgorithm() {
		return algorithm;
	}

	public void setAlgorithm(String algorithm) {
		this.algorithm = algorithm;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public ComponentType getType() {
		return type;
	}

	public void setType(ComponentType type) {
		this.type = type;
	}

	public String getModelType() {
		return modelType;
	}

	public void setModelType(String modelType) {
		this.modelType = modelType;
	}

	public int getxPos() {
		return xPos;
	}

	public void setxPos(int xPos) {
		this.xPos = xPos;
	}

	public int getyPos() {
		return yPos;
	}

	public void setyPos(int yPos) {
		this.yPos = yPos;
	}

	public List<String> getFront() {
		return front;
	}

	public void setFront(List<String> front) {
		this.front = front;
	}

	public List<String> getNext() {
		return next;
	}

	public void setNext(List<String> next) {
		this.next = next;
	}

	public T getParameter() {
		return parameter;
	}

	public void setParameter(T parameter) {
		this.parameter = parameter;
	}
}
